import { Module, forwardRef } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { VFSController } from './vfs.controller';
import { VFSService } from './vfs.service';
import { VFSEventService } from './vfs-event.service';
import { FileSystemEntryBuilder } from './file-system-entry-builder.service';
import { MCPController } from './mcp/mcp.controller';
import { VFSMCPServer } from './mcp/vfs-mcp-server';
import { LcDocumentSchema, LcProjectSchema } from '../../types/editor.schema';
import { TypeSchema } from '@/types/modules/superType/types/schemas/type.schema';
import { SocketModule } from '@/modules/socket/socket.module';
import { TypeModule } from '@/types/modules/superType/server/type.module';

@Module({
  imports: [
    MongooseModule.forFeature([
      { name: 'project', schema: LcProjectSchema },
      { name: 'doc', schema: LcDocumentSchema },
      { name: 'type', schema: TypeSchema },
    ]),
    forwardRef(() => SocketModule), // 导入 SocketModule 以使用 SocketGateway
    forwardRef(() => require('../editor.module').EditorModule), // 导入 EditorModule 以使用 EditorService
    forwardRef(() => TypeModule), // 导入 TypeModule 以使用 TypeService
  ],
  controllers: [VFSController, MCPController],
  providers: [VFSService, VFSEventService, FileSystemEntryBuilder, VFSMCPServer],
  exports: [VFSService, VFSEventService, FileSystemEntryBuilder, VFSMCPServer],
})
export class VFSModule {}